package edu.bit.water.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;

import java.text.ParseException;
import java.util.Date;
import java.text.SimpleDateFormat;


public class EntityWater {

	private int id;		//主键
	private String sensorRowId;	//传感器编号
	private Float value;	//监测值
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	private Date createdAt;  //创建或修改时间
	private Integer operator;  //操作人员id号
	private int companyId;
	private String location;//所处位置
	private String sensorType;//传感器类型
	private String workshop;//车间名称

	public String getYearMonth() {
		return yearMonth;
	}

	public void setYearMonth(String yearMonth) {
		this.yearMonth = yearMonth;
	}

	private String yearMonth;

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	private String time;

	public void setCreatedAt(String time) throws ParseException {
		if(time.contains(".")) {
			this.createdAt = HSSFDateUtil.getJavaDate(Double.valueOf(time));
		}
		else {
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			this.createdAt = simpleDateFormat.parse(time);
		}
	}


	public void setCreatedAt__(String time) throws ParseException {
		if(time.contains(".")) {
			this.createdAt = HSSFDateUtil.getJavaDate(Double.valueOf(time));
		}
		else {
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
			this.createdAt = simpleDateFormat.parse(time);
		}
	}
	public String getWorkshop() {return this.workshop;}
	public void setWorkshop(String workshop) {this.workshop = workshop;}

	public String getSensorType() {return this.sensorType;}
	public void setSensorType(String sensorType) {this.sensorType = sensorType;}

	public String getLocation() {return this.location;}
	public void setLocation(String location) {this.location = location;}



	public int getCompanyId() {return this.companyId;}

	public void setCompanyId(int companyId) {
		this.companyId = companyId;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getSensorRowId() {
		return sensorRowId;
	}

	public void setSensorRowId(String sensorRowId) {
		this.sensorRowId = sensorRowId;
	}

	public float getValue() {
		return value;
	}

	public void setValue(float value) {
		this.value = value;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public Integer getOperator() {
		return operator;
	}

	public void setOperator(Integer operator) {
		this.operator = operator;
	}
}
